const router = require('koa-router')()
const {exec}=require('../db')

router.get('/getlist', async (ctx, next) => {
  let {pageSize,pageIndex}=ctx.query
  let pageSql=`SELECT * FROM juejin LIMIT ${pageIndex},${pageSize}`
  let totalSql=`SELECT * FROM juejin`
  const data=await exec(pageSql)
  const total=await exec(totalSql)
  ctx.body={
    data,
    total:total.length
  }
})
module.exports = router
